<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>订单查询</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">
	<script type="text/javascript" src="{$url_js}jquery-2.2.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}bootstrap.min.js"></script>

	<link rel="stylesheet" href="{$url_css}sweet-alert.css"/>
	<script type="text/javascript" src="{$url_js}sweet-alert.min.js"></script>

	<style type="text/css">
		{literal}
		.page_info div {
			display: inline-block;
		}

		.page_info .p_l {
			color: #666;
			float: left;
			line-height: 69px;
			font-size: 16px;
		}

		.page_info .p_r {
			color: #337AB7;
			float: right;
		}

		{/literal}
	</style>
</head>
<body>

<div class="container" style="width:96%">
	<form action="?do=Default" method="get">
		<table class="table table-bordered table-striped" align="center">
			<tr>
				<td colspan="6">查询条件</td>
			</tr>
			<tr>
				<td class="form-group col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">用户ID</div>
						<input type="text" class="form-control" name="UserId" placeholder="用户ID"
						       value="{$param['UserId']}">
					</div>
				</td>
				<td class="form-group col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">手机</div>
						<input type="text" class="form-control" name="Mobile" placeholder="用户手机"
						       value="{$param['Mobile']}">
					</div>
				</td>
				<td class="form-group col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">交易号</div>
						<input type="text" class="form-control" name="TradeNo" placeholder="交易号"
						       value="{$param['TradeNo']}">
					</div>
				</td>
				<td class="form-group col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">{$field.Status.Title}</div>
						<select name="Status" class="form-control">
							<option value="">全部</option>
							{foreach $field['Status']['Data'] as $k => $v}
								<option value="{$k}" {if $param['Status'] === $k}selected{/if}>{$v}</option>
							{/foreach}
						</select>
					</div>
				</td>

				<td class="form-group col-xs-2" colspan="5" align="right">
					<input type="submit" value="搜索" class="btn btn-primary"/>
					<input type="submit" name="exportExcel" value="导出" class="btn btn-primary"/>
				</td>
			</tr>
		</table>
	</form>
</div>

<div class="container" style="width:96%">
	<table class="table table-bordered table-striped" align="center">
		<thead>
		<tr>
			<th>订单ID</th>
			<th>用户ID</th>
			<th>昵称</th>
			<th>支付流水号</th>
			<th>商品</th>
			<th>支付平台</th>
			<th>交易号</th>
			<th>支付金额(元)</th>
			<th>支付状态</th>
			<th>更新时间</th>
			<th>创建时间</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		{foreach $list as $v}
			<tr style="height: 60px; overflow: hidden">
				<td>{$v['PaymentId']}</td>
				<td>{$v['UserId']}</td>
				<td>{$user[$v['UserId']]}</td>
				<td>{$v['SN']}</td>
				<td>{$field['ProductId']['Data'][$v['ProductId']]}</td>
				<td>{$field['PaymentType']['Data'][$v['PaymentType']]}</td>
				<td>{$v['TradeNo']}</td>
				<td>{$v['TotalFee']}</td>
				<td>{$field['Status']['Data'][$v['Status']]}</td>
				<td>{$v['UpdateTime']}</td>
				<td>{$v['CreateTime']}</td>
				<td>
					{if $v['Status'] ==2}<a class="btn btn-default invite_reward" data-day="{$v.disDay}" data-id="{$v['PaymentId']}">进贡奖励</a>{/if}
				</td>
			</tr>
		{/foreach}
		</tbody>
	</table>
	{if !empty($pagination)}
		<table class="table table-bordered table-striped" align="center">
			<tr>
				<td colspan="7" align="right">
					<div class="page_info">
						{if $page_info['count']}
							<div class="p_l">一共 {$page_info['count']} 条数据,共 {$page_info['page']} 页</div>
						{/if}
					</div>
					<div class="p_r">{$pagination}</div>
				</td>
			</tr>
		</table>
	{/if}
</div>
<script type="application/javascript">
    $(".invite_reward").click(function () {
        var day = $(this).attr('data-day'), id = $(this).attr('data-id'), obj = $(this);
        top.swal({
            title: '确认发放邀请奖励',
            text: '请谨慎操作，一旦发放不可撤销!',
            type: "warning",
            showCancelButton: true,
            cancelButtonText: '取消',
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            closeOnConfirm: false
        }, function (isConfirm) {
            if (isConfirm) {
                $.ajax({
                    url: '?do=InviteReward',
                    type: "POST",
                    data: { id:id },
                    dataType: "json",
                    success: function (json) {
                        setTimeout(function () {
                            top.swal(json);
                        }, 100);
                        if (json.type == 'success') {
                            obj.hide();
                            top.swal('success', json.msg, 'success');
                        } else {
                            top.swal('error', json.msg, 'error');
                        }
                    }
                });
            }
        });
    });
</script>
</body>
</html>